package day04;

import java.io.File;
import java.io.FileInputStream;
import java.util.Base64;

public class Demo06 {
    public static void main(String[] args) throws Exception {
        /*
         * 将照片编码为Base64
         *
         */
        File file = new File("./b.jpg");
        byte[] bytes = new byte[(int)file.length()];
        FileInputStream in = new FileInputStream(file);
        in.read(bytes);
        String base64 = Base64.getEncoder().encodeToString(bytes);
        System.out.println(base64);
    }
}
